__author__ = """Zach Seifts <zach.seifts@gmail.com>"""
__docformat__ = 'plaintext'

from AccessControl import ClassSecurityInfo
from Products.Archetypes.atapi import *
from Products.synchronicity.config import *


schema = Schema((

    TextField(
        name='description',
        widget=TextAreaWidget(
            label="Description",
            description="A Description of the project",
            label_msgid='synchronicity_label_description',
            description_msgid='synchronicity_help_description',
            i18n_domain='synchronicity',
        ),
        required=True,
        searchable=False,
        label="Description"
    ),

    DateTimeField(
        name='requestdate',
        widget=CalendarWidget(
            label="Request Date",
            description="The date that this project was requsted.",
            label_msgid='synchronicity_label_requestdate',
            description_msgid='synchronicity_help_requestdate',
            i18n_domain='synchronicity',
        ),
        required=True,
        description="The date that this project was requsted.",
        label="Request Date"
    ),

    DateTimeField(
        name='startdate',
        widget=CalendarWidget(
            label="Start Date",
            description="The date that this project was started.",
            label_msgid='synchronicity_label_startdate',
            description_msgid='synchronicity_help_startdate',
            i18n_domain='synchronicity',
        ),
        required=False,
        description="The date that this project was started.",
        label="Start Date"
    ),

),
)

Project_schema = BaseFolderSchema.copy() + \
    schema.copy()

class Project(BaseFolder):
    """
    """
    security = ClassSecurityInfo()
    __implements__ = (getattr(BaseFolder,'__implements__',()),)

    # This name appears in the 'add' box
    archetype_name = 'Project'

    meta_type = 'Project'
    portal_type = 'Project'
    allowed_content_types = ['Requirement', 'Objective', 'Task']
    filter_content_types = 1
    global_allow = 1
    #content_icon = 'Project.gif'
    immediate_view = 'Project'
    default_view = 'Project'
    suppl_views = ()
    typeDescription = "A collection of objectives, tasks, and bugs used in the development of an application"
    typeDescMsgId = 'description_edit_project'

    _at_rename_after_creation = True

    schema = Project_schema

    # Methods


registerType(Project, PROJECTNAME)